﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;
using Rung.Net.Base;

namespace Rung.Net.Unsafe
{
    public class UnsafeStream : NetBaseStream<byte[]>
    {
        public UnsafeStream(NetworkStream stream, EndPoint endpoint)
            : base(stream, endpoint)
        {
        }

        public override void Send(byte[] data)
        {
            if (data.Length > 512)
                throw (new Exception("不支持长度大于 512 的字节传送。"));
            else
                base.SendRaw(data);
        }

        protected override void ReceivedRaw(byte[] bytes)
        {
            RaiseOnReceived(bytes);
        }
    }
}
